/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package com.ventasimple.modelo;

import java.io.Serializable;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

/**
 *
 * @author Claudio
 */
@Entity
@Table(name = "pu_publicacion_item_caracteristica")
public class PublicacionItemCaracteristica implements Serializable{ 
    
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)    
    @Column(name = "ID")
    private Integer id;
    
    @Column(name = "ORDEN")
    private Integer orden;
        
    @Column(name = "ACTIVA", length = 1)
    private String activa;
    
    @JoinColumn(name = "ID_CARACTERISTICA", referencedColumnName = "ID")
    @ManyToOne(fetch = FetchType.LAZY)
    private Caracteristica caracteristica;
    
    @JoinColumn(name = "ID_TIPO", referencedColumnName = "ID")
    @ManyToOne(fetch = FetchType.LAZY)
    private PublicacionTipoCaracteristica tipoCaracteristica;

    public PublicacionItemCaracteristica() {
        
        this.activa = "S";        
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public Integer getOrden() {
        return orden;
    }

    public void setOrden(Integer orden) {
        this.orden = orden;
    }

    public String getActiva() {
        return activa;
    }

    public void setActiva(String activa) {
        this.activa = activa;
    }

    public Caracteristica getCaracteristica() {
        return caracteristica;
    }

    public void setCaracteristica(Caracteristica caracteristica) {
        this.caracteristica = caracteristica;
    }

    public PublicacionTipoCaracteristica getTipoCaracteristica() {
        return tipoCaracteristica;
    }

    public void setTipoCaracteristica(PublicacionTipoCaracteristica tipoCaracteristica) {
        this.tipoCaracteristica = tipoCaracteristica;
    }

    @Override
    public int hashCode() {
        int hash = 3;
        hash = 97 * hash + (this.id != null ? this.id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object obj) {
        if (obj == null) {
            return false;
        }
        if (getClass() != obj.getClass()) {
            return false;
        }
        final PublicacionItemCaracteristica other = (PublicacionItemCaracteristica) obj;
        if (this.id != other.id && (this.id == null || !this.id.equals(other.id))) {
            return false;
        }
        return true;
        
    }

    @Override
    public String toString() {
        return "PublicacionItemCaracteristica{" + "id=" + id + '}';
    }
    
}
